# 语句出错或者异常自动退出 不继续执行
set -e

SCRIPT=$(readlink -f "$0")
INSTALLPATH=$(dirname "${SCRIPT}")
TOPDIR=$(dirname "${INSTALLPATH}")

if [[ $# < 1 ]]; then
    git clone https://gitee.com/dhc_king/learning_logs.git ${TOPDIR}/learning_logs
    git clone https://gitee.com/dhc_king/django_flybbs.git ${TOPDIR}/django_flybbs
elif [[ $1 == "update" ]]; then
    git -C ${TOPDIR}/learning_logs/ checkout master
    git -C ${TOPDIR}/learning_logs/ pull origin master

    git -C ${TOPDIR}/django_flybbs/ checkout master
    git -C ${TOPDIR}/django_flybbs/ pull origin master
else
    echo "参数不正确"
fi
